.\"   $Id: delchain.3,v 1.1 2002/03/08 13:51:01 fred Exp $
.\" @(#)delchain.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
delchain
.XE
.XS4 \n%
.ti 0.2i
delchain
.XE4 \}
.TH DELCHAIN 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS"
.SH NAME
delchain \- delete an element of a \fBchain_list\fP
.so man1/alc_origin.1
.SH SYNOPSIS
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mut.h"
chain_list \(**delchain(pthead, ptdel)
chain_list \(**pthead;
chain_list \(**ptdel;
.ft R
.fi
.SH PARAMETERS
.TP 20
\fIpthead\fP
Pointer to a \fBchain\fP list
.TP
\fIptdel\fP
Pointer to the element to be deleted.
.SH DESCRIPTION
\fBdelchain\fP deletes the element of the \fBchain_list\fP pointed to by
\fIptdel\fP in the list pointed to by \fIpthead\fP.
The list consistency is maintainded, and the element put back in the list
of free blocks.
.SH RETURN VALUE
\fBdelchain\fP returns a pointer to the new head of list if the \fIptdel\fP
pointer used to belong to the list. In most case, it has the value of
\fIpthead\fP. If the pointer doesn't belong to the list, \fBNULL\fP is returned.
.SH ERROR
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
"\(**\(**\(** mbk error \(**\(**\(** delchain impossible : pointer NULL"
.ft R
.RS
At least one of the arguments are pointing to \fBNULL\fP, and that clear that
such a pointer can't be deleted, or used for freeing.
.RE
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mut.h"
void delete_match(c0, c1)
chain_list \(**c0, \(**c1;
{
chain_list \(**t0, \(**t1, \(**next;
	for (t0 = c0; t0; t0 = next)
		for (t1 = c1; t1; t1 = t1\->NEXT)
			if (t1\->DATA == t0\->DATA)
				next = delchain(c0, t0);	 
}
.ft R
.fi
.SH SEE ALSO
.BR mbk (1),
.BR chain (3),
.BR addchain (3),
.BR freechain (3).


.so man1/alc_bug_report.1

